Add explict unlink of position for realtime KML.
authorrobertl <robertl>
Fri, 20 Oct 2006 14:44:58 +0000 (14:44 +0000)
committerrobertl <robertl>
Fri, 20 Oct 2006 14:44:58 +0000 (14:44 +0000)
kml.c

diff --git a/kml.c b/kml.c
index 3d6f947651b2f95b67051c4f594d78840b248f81..92a5e7fa83a77abdeecb19d7885f163ad9c9dcf3 100644 (file)
--- a/kml.c
+++ b/kml.c
@@ -278,6 +278,17 @@ kml_wr_deinit(void)
        fclose(ofd);
 
        if (posnfilenametmp) {
+#if __WIN32__
+               /*
+                * This is gross.
+                * Windows does not offer an atomic rename; we must
+                * explictly remove the destination here which exposes
+                * a window where a polled reader of this file could find
+                * the file to be missing.  Windows readers will simply
+                * have to retry on this case.
+                */
+               unlink(posnfilename);
+#endif
                rename(posnfilenametmp, posnfilename);
                xfree(posnfilenametmp);
                posnfilenametmp = NULL;